Skip to content

Backup strategy using pg-dump #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

gmauro
Copy link
Member

@gmauro gmauro commented Nov 18, 2021

from @sj213

@hexylena
Copy link
Member

Have you seen #30 ? I mentioned it on @sj213's PR but I guess it might've been missed.

@gmauro
Copy link
Member Author

gmauro commented Nov 18, 2021

I am pinging Sj. Let's wait for a comment from him

@sj213
Copy link

sj213 commented Nov 18, 2021

As far as I can see #30 is about the WAL-archiving backup method; at usegalaxy.eu we have been using plain old DB dumps (using pg_dumpall(1)) ever since we started the site and I prefer sticking with that method for the time being, mainly because I have no practical experience with WAL-archiving. Given the current (and ever growing) size of the database we might one day need to reconsider but for the moment I just wanted to carry our status quo over to the new server instance. I didn't rly intend to push the PR upstream either, that's why I closed my first PR when I realized it had propagated upward. Of course, we should merge the fixes for WAL-archiving from 'galaxyproject' into 'usegalaxy.eu', for possible future use.

@hexylena
Copy link
Member

and I prefer sticking with that method for the time being

Fair enough!

I'll give this a whirl and merge it. Thanks for upstreaming it though, we definitely appreciate it! A traditional pg_dumpall is still a fantastic option for a lot of smaller servers (and bigger ones too!)

@@ -1,6 +1,9 @@
---

postgresql_default_version: 10
postgresql_default_version: 13
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@natefoo any issue with this?

Copy link
Member

@hexylena hexylena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall looks fine, let's enable it!


postgresql_pgdump_cronspec: "00 18 * * 1-7"
postgresql_pgdump_filespec: 'full.daily.`/bin/date +"\%u"`.sql'

Copy link
Member

@hexylena hexylena Nov 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# postgresql_pgdump_dir:

I think this needs to be documented somewhere, maybe in the readme?

Comment on lines +12 to +17
template:
src: local-pgdump.crontab
dest: /etc/cron.d/local-pgdump
owner: root
group: root
mode: 0644
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should do this via the cron module to be a bit more standard

Suggested change
template:
src: local-pgdump.crontab
dest: /etc/cron.d/local-pgdump
owner: root
group: root
mode: 0644
- name: Creates a cron file under /etc/cron.d
ansible.builtin.cron:
name: Regular pgdump
month: "{{ postgresql_pgdump_cron_month | default(omit) }}"
weekday: "{{ postgresql_pgdump_cron_weekday | default(omit) }}"
day: "{{ postgresql_pgdump_cron_day | default(omit) }}"
minute: "{{ postgresql_pgdump_cron_minute | default(omit) }}"
hour: "{{ postgresql_pgdump_cron_hour | default(omit) }}"
user: "{{ postgresql_user_name }}"
job: "{{ postgresql_inst_dir_default }}/bin/pg_dumpall -c -f {{ postgresql_pgdump_dir }}/{{ postgresql_pgdump_filespec }}"
cron_file: ansible_local-pgdump

@@ -30,3 +33,7 @@ postgresql_backup_command: >-
--keep {{ postgresql_backup_keep | quote }}
{{ '--pg-bin-dir ' ~ __postgresql_pgdg_bin_dir if ansible_os_family == 'RedHat' else '' }}
--backup --clean-archive {{ postgresql_backup_dir | quote }}

postgresql_pgdump_cronspec: "00 18 * * 1-7"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
postgresql_pgdump_cronspec: "00 18 * * 1-7"
postgresql_pgdump_cron_month: "*"
postgresql_pgdump_cron_weekday: "*"
# postgresql_pgdump_cron_day:
postgresql_pgdump_cron_minute: 0
postgresql_pgdump_cron_hour: 18

@@ -0,0 +1 @@
{{ postgresql_pgdump_cronspec }} {{ postgresql_user_name }} {{ postgresql_inst_dir_default }}/bin/pg_dumpall -c -f {{ postgresql_pgdump_dir }}/{{ postgresql_pgdump_filespec }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now unnecessary

Without this task the repo installation failed during rocky 9 testing
Add install RPM GPG key task to redhat variant
Update postgresql repositry keys for redhat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants